package net.nettytlv;

import net.nettytlv.domain.Packet;

import io.netty.buffer.Unpooled;

public class PacketUtil {

    /**
     * 心跳请求.
     */
    public static Packet createPingReq(int clientId) {
        return Packet.builder()
                .type((byte) 1)
                .length((short) 4)
                .value(Unpooled.copyInt(clientId).array())
                .build();
    }

    /**
     * 心跳响应.
     */
    public static Packet createPingAck(int clientId) {
        return Packet.builder()
                .type((byte) 2)
                .length((short) 4)
                .value(Unpooled.copyInt(clientId).array())
                .build();
    }

}
